package top.aicats.pattern.dynamicProxy.JDKMeiPo;

import sun.misc.ProxyGenerator;
import top.aicats.pattern.dynamicProxy.Customer;
import top.aicats.pattern.dynamicProxy.Person;

import java.io.FileOutputStream;

public class JDKMeiPoTest {
    public static void main(String[] args) {
        try {
            Person obj = (Person) new JDKMeipo().getInstance(new Customer());
            obj.findLove();

            byte[] bytes = ProxyGenerator.generateProxyClass("$Proxy0", new Class[]{Person.class});
            FileOutputStream os = new FileOutputStream("D://$Proxy0.class");
            os.write(bytes);
            os.close();
        } catch (Exception ex)
        {
            ex.printStackTrace();
        }
    }
}
